Skip to content

Detailed IPOPT Log in ipopt_v2 #3577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
May 21, 2025
Merged

Detailed IPOPT Log in ipopt_v2 #3577

merged 27 commits into from
May 21, 2025

Conversation

mrmundt
Copy link
Contributor

@mrmundt mrmundt commented Apr 24, 2025

Fixes #548, #728 , IDAES/idaes-pse#92

Summary/Motivation:

There is a utility wrapper in parmest that gathers helpful data from the IPOPT log that has never been promoted to a "real world citizen." This PR replaces the need for that in ipopt_v2 by parsing the output and storing important data by default on the Results object.

NOTE: This PR contains #3576 so that one needs to be merged first.

Changes proposed in this PR:

  • Update IPOPT parsing logic to capture iterations, various final scaled/unscaled results, the full solver log, etc.
  • Update tests to ensure that we are actually capturing the output
  • Fix a really sneaky bug that only appeared on older Python versions in Windows that stopped output from being captured

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

Copy link
Contributor

@michaelbynum michaelbynum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple minor comments. Yay for improved type hints!

@mrmundt mrmundt requested a review from michaelbynum May 2, 2025 13:36
@michaelbynum
Copy link
Contributor

Oh, is there a copy of the log parsing code in parmest that needs to be removed?

@mrmundt
Copy link
Contributor Author

mrmundt commented May 5, 2025

Oh, is there a copy of the log parsing code in parmest that needs to be removed?

I'm hesitant to remove anything from parmest because I don't know how it's being used outside of Pyomo (e.g., it might be "the thing" that people are using to parse IPOPT output in other places). I figure it's something we can either (a) leave because it does no harm or (b) remove in the future with a fair deprecation warning.

@blnicho blnicho self-requested a review May 6, 2025 19:09
Copy link
Member

@jsiirola jsiirola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of parsing questions

Comment on lines +467 to +471
# Set iteration_log visibility to ADVANCED_OPTION because it's
# a lot to print out with `display`
results.extra_info.get("iteration_log")._visibility = (
ADVANCED_OPTION
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not just set when it is originally created?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's implicitly declared. Is there a different way to do it in that scenario?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably make a public API for changing the visibility, then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me but not part of this PR.

@mrmundt mrmundt requested a review from jsiirola May 20, 2025 15:03
@jsiirola jsiirola merged commit 06452a9 into Pyomo:main May 21, 2025
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

return final Ipopt values in solution object
3 participants